/*
 *  $Id: Death.cs 975 2009-12-16 17:13:22Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

using System;

namespace Ragima.Affects {
    /// <summary>
    /// Эффект: смерть
    /// Параметр: число ходов до смерти
    /// Умирает через определенное число ходов.
    /// </summary>
    public class Death: TimeAffect {
        public Death(): this(1) {}
        public Death(int count): base(count*4) {}

        public override string Id {
            get { return "death"; }
        }
        public override string NameText {
            get { return Name.GetText(Phases/4); }
        }
        public override ElementType Element {
            get { return ElementType.Darkness; }
        }

        public override bool Dispellable {
            get { return false; }
        }

        public override string DescriptionText {
            get { return Description.GetText(Phases/4); }
        }

        public override int BaseWeight {
            get { return Math.Min(-80 + Math.Max(Phases-4, 0) * 4, -20); }
        }

        public override AffectIcon Icon {
            get { return AffectIcon.Death; }
        }

        public override Affect Clone() {
            return new Death(Phases/4);
        }

        protected override void DecrementPhases() {
            AbstractObject owner = Owner;
            base.DecrementPhases();
            if (IsEnded) owner.InstantDeath();
        }
    }
}